#include <iostream>
#include <cstring>
#include <cmath>
using namespace std;

const int N = 110, M = 1010;

double pos_x[N], pos_y[N];
int n, m, s, t;
struct node{
	int a, b;
	double c;
}e[M];
double dist[N];

double calc(int a, int b)
{
	double dx = pos_x[a] - pos_x[b];
	double dy = pos_y[a] - pos_y[b];
	return sqrt(dx * dx + dy * dy);
}

void bellman()
{
	for(int i = 1; i <= n; i++) dist[i] = 1e10;
	dist[s] = 0;
	for(int i = 1; i < n; i++)
	{
		for(int j = 1; j <= m; j++)
		{
			int a = e[j].a, b = e[j].b;
			double c = e[j].c;
			if(dist[a] + c < dist[b]) dist[b] = dist[a] + c;
			if(dist[b] + c < dist[a]) dist[a] = dist[b] + c; 
		}
	}
}
//void bellman()
//{
//	for (int i = 1; i <= n; i++) dist[i] = 1e10;
//	dist[s] = 0;
//
//	for (int i = 1; i < n; i++)
//	{
//		for (int j = 1; j <= m; j++)
//		{
//			int a = e[j].a, b = e[j].b;
//			double c = e[j].c;
//			if (dist[a] + c < dist[b])
//			{
//				dist[b] = dist[a] + c;
//			}
//			if (dist[b] + c < dist[a])
//			{
//				dist[a] = dist[b] + c;
//			}
//		}
//	}
//}

int main()
{
	cin >> n;
	for(int i = 1; i <= n; i++)
	{
		cin >> pos_x[i] >> pos_y[i];
	}
	cin >> m;
	for(int i = 1; i <= m; i++)
	{
		int a, b; cin >> a >> b;
		e[i].a = a; e[i].b = b; e[i].c = calc(a, b);
	}
	cin >> s >> t;
	
	bellman();
	
	printf("%.2lf", dist[t]);
	return 0;
}
